package test;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-11-04
 * Time: 17:11
 */
public class BankUser {
    private String id;
    private String userName;
    private double balance;

    public BankUser() {
    }

    public BankUser(String id, String userName, double balance) {
        this.id = id;
        this.userName = userName;
        this.balance = balance;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    @Override
    public String toString() {
        return "BankUser{" +
                "id='" + id + '\'' +
                ", userName='" + userName + '\'' +
                ", balance=" + balance +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BankUser bankUser = (BankUser) o;
        return Double.compare(bankUser.balance, balance) == 0 && Objects.equals(id, bankUser.id) && Objects.equals(userName, bankUser.userName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userName, balance);
    }
}
